package org.wu.framework.web.response.exceptions;

import org.wu.framework.web.response.enmus.DefaultResultCode;

/**
 * 运行编码异常
 */
public class RuntimeCodeException extends RuntimeException {

    /**
     * Constructs a new runtime exception with {@code null} as its
     * detail message.  The cause is not initialized, and may subsequently be
     * initialized by a call to {@link #initCause}.
     */
    public RuntimeCodeException(Integer code) {
        this.code = code;
    }


    /**
     * 错误编码
     *
     * @see DefaultResultCode
     */
    private final Integer code;

    public RuntimeCodeException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public RuntimeCodeException(Throwable cause, Integer code) {
        super(cause);
        this.code = code;
    }

    public RuntimeCodeException(String message, Throwable cause, Integer code) {
        super(message, cause);
        this.code = code;
    }

    public RuntimeCodeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer code) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }
}
